import 'dart:io';

import 'package:dio/dio.dart';
import 'package:laos_mall/models/cart/cart_model.dart';
import 'package:laos_mall/models/cart/checkout_model.dart';
import 'package:laos_mall/models/cart/collect_model.dart';
import 'package:laos_mall/models/category/category_model.dart';
import 'package:laos_mall/models/category/keyword_model.dart';
import 'package:laos_mall/models/category/product_list_model.dart';
import 'package:laos_mall/models/config/area_code_model.dart';
import 'package:laos_mall/models/config/currency_model.dart';
import 'package:laos_mall/models/home/home_model.dart';
import 'package:laos_mall/models/home/language_model.dart';
import 'package:laos_mall/models/home/product_detail_model.dart';
import 'package:laos_mall/models/order/order_model.dart';
import 'package:laos_mall/models/user/address_model.dart';
import 'package:laos_mall/models/user/coupon_model.dart';
import 'package:laos_mall/models/user/qr_code_model.dart';
import 'package:laos_mall/models/user/user_model.dart';
import 'package:retrofit/http.dart';
import 'package:retrofit/retrofit.dart';
import 'result.dart';
part 'rest_client.g.dart';
@RestApi()
abstract class RestClient {
  factory RestClient(Dio dio, {String baseUrl}) = _RestClient;

  // // ///获取验证码
  // @POST("/projecta/verificationcode")
  // Future<Result<String>> verificationcode(@Body() Map<String, dynamic> param);

  ///获取验证码
  @GET("/harbor-app/userLogin/sendCode")
  Future<Result<String>> sendCode(@Queries() Map<String, dynamic> param);

  ///验证码登陆
  @POST("/harbor-app/svLogin/codeLogin")
  Future<Result<String>> codeLogin(@Body() Map<String, dynamic> param);

  ///区号选择
  @GET("/api/common/config/mobile_area_code")
  Future<Result<AreaCodeModel>> areaCode(@Queries() Map<String, dynamic> param);

  ///货币列表
  @GET("/api/common/currency/get_currency")
  Future<Result<CurrencyModel>> currency(@Queries() Map<String, dynamic> param);


  ///home
  @GET("/api/home/home/poster")
  Future<Result<HomeModel>> homeData(@Queries() Map<String, dynamic> param);

  ///language
  @GET("/api/common/i18n/get_locales")
  Future<Result<LanguageModel>> languageList(@Queries() Map<String, dynamic> param);

  ///productDetail
  @GET("/api/product/product/detail")
  Future<Result<ProductDetailModel>> productDetail(@Queries() Map<String, dynamic> param);

  ///购物车
  @POST("/api/product/product/add_to_cart")
  Future<Result<dynamic>> addToCart(@Body() Map<String, dynamic> param);

  ///分类
  @GET("/api/category/category/all")
  Future<Result<CategoryModel>> getAllCategory(@Queries() Map<String, dynamic> param);

  ///商品列表
  @GET("/api/search/search/get_product")
  Future<Result<ProductListModel>> productList(@Queries() Map<String, dynamic> param);

  ///猜你喜欢
  @GET("/api/common/recommend/guess_like")
  Future<Result<ProductListModel>> guessLike(@Queries() Map<String, dynamic> param);

  ///搜索记录
  @GET("/api/search/search_guess/index")
  Future<Result<KeywordModel>> keywordList(@Queries() Map<String, dynamic> param);

  @POST("/api/user/regist/regist_act")
  Future<Result<dynamic>> register(@Body() Map<String, dynamic> param);

  ///注册验证码
  @POST("/api/user/regist/send_mobile_code")
  Future<Result<dynamic>> registerAuthCode(@Body() Map<String, dynamic> param);

  ///忘记密码获取验证码
  @POST("/api/user/user/send_mobile_code_by_modify_password")
  Future<Result<dynamic>> changPwdAuthCode(@Body() Map<String, dynamic> param);

  ///修改密码
  @POST("/api/user/login/forget_password")
  Future<Result<dynamic>> changePwd(@Body() Map<String, dynamic> param);

  @POST("/api/user/login/signin")
  Future<Result<dynamic>> loginPwd(@Body() Map<String, dynamic> param);


  @POST("/api/product/product/add_to_cart")
  Future<Result<dynamic>> addCart(@Body() Map<String, dynamic> param);

  ///购物车
  @GET("/api/cart/cart/list")
  Future<Result<CartModel>> cartList(@Queries() Map<String, dynamic> param);

  ///更新购物车选中
  @POST("/api/cart/cart/update_check")
  Future<Result<dynamic>> updateCheck(@Body() Map<String, dynamic> param);

  ///clear
  @POST("/api/cart/cart/clear")
  Future<Result<dynamic>> cleanCart(@Body() Map<String, dynamic> param);

  @POST("/api/cart/cart/remove_item")
  Future<Result<dynamic>> deleteCart(@Body() Map<String, dynamic> param);

  ///商品收藏列表
  @GET("/api/user/collect_product/list")
  Future<Result<CollectModel>> collectProductList(@Queries() Map<String, dynamic> param);


  @POST("/api/user/collect_product/save")
  Future<Result<dynamic>> collectSave(@Body() Map<String, dynamic> param);

  @POST("/api/user/collect_product/cancel")
  Future<Result<dynamic>> collectCancel(@Body() Map<String, dynamic> param);

  ///商品收藏列表
  @GET("/api/sys/region/get_region_tree")
  Future<Result<dynamic>> getRegionTree(@Queries() Map<String, dynamic> param);


  @POST("/api/user/address/create")
  Future<Result<dynamic>> addAddress(@Body() Map<String, dynamic> param);

  ///地址列表
  @GET("/api/user/address/list")
  Future<Result<AddressModel>> addressList(@Queries() Map<String, dynamic> param);

  ///我的优惠券列表
  @GET("/api/user/coupon/list")
  Future<Result<CouponModel>> myCoupons(@Queries() Map<String, dynamic> param);

  ///优惠券列表
  @GET("/api/user/coupon/get_list")
  Future<Result<CouponModel>> couponList(@Queries() Map<String, dynamic> param);


  @POST("/api/user/coupon/claim")
  Future<Result<CheckoutModel>> couponClaim(@Body() Map<String, dynamic> param);


  @POST("/api/order/check/index")
  Future<Result<CheckoutModel>> checkOut(@Body() Map<String, dynamic> param);

  ///结算更新优惠券
  @POST("/api/order/check/update_coupon")
  Future<Result<CheckoutModel>> checkOutUpdateCoupon(@Body() Map<String, dynamic> param);

  ///提交订单
  @POST("/api/order/check/submit")
  Future<Result<CheckoutModel>> checkOutSubmit(@Body() Map<String, dynamic> param);


  ///订单列表
  @GET("/api/user/order/list")
  Future<Result<OrderModel>> orderList(@Queries() Map<String, dynamic> param);

  @POST("/api/user/order/cancel_order")
  Future<Result<dynamic>> cancelOrder(@Body() Map<String, dynamic> param);

  ///对应的是账户信息
  @GET("/api/user/user/detail")
  Future<Result<UserDataModel>> userDetail(@Queries() Map<String, dynamic> param);

  ///用户信息
  @GET("/api/user/user/member_center")
  Future<Result<UserInfoDataModel>> userInfo(@Queries() Map<String, dynamic> param);


  @GET("/api/common/util/qr_code")
  Future<Result<QRCodeModel>> getQrCode(@Queries() Map<String, dynamic> param);

  ///文件上传
  @POST("/api/user/user/modify_avatar")
  @MultiPart()
  Future<Result<dynamic>> fileUpload(
      @Part() File file, @Part() String folderType);


}
